version 14.2
#delimit ;
log using "F:\Government Formation in Asian-Pacific Democracies.log", replace;
set more off;


* ***************************************************************** *;
* ***************************************************************** *;
* File-Name: model1_re_pp.do *;
* Date: 5/30/2022 *;
* Author: MG *;
* Purpose: Analysis [Random Effects, Country Clusters](No bargaining institutions variables) *;
* Input File: data_stata_pp.dta *;
* Data Output: None *;
* Previous file: None *;
* Machine: laptop *;
* **************************************************************** *;
* **************************************************************** *;

use "F:\Government Formation in Asian-Pacific Democracies\Portfolio Allocation\data_stata_pp.dta", clear;


gen portfolioshare = . ;

replace portfolioshare = party_port2/gov_port2 ;

gen seatshare = . ;

replace seatshare = party_seats/gov_seats ;

gen parliamentary = . ;
 
replace parliamentary = 1 if presidential ==0 ;

replace parliamentary = 0 if presidential == 1 ;

gen seatshare_parl = . ;

replace seatshare_parl = seatshare * parliamentary ;

gen formateur_parl = . ;

replace formateur_parl = formateur * parliamentary ;

************************* ;
*  Summarize variables    ;
************************* ;

sum;


********************************************************************** ;
*  Table A.8, Model 1, re-arranged to put seatshare IVs last           ;
* Y = b0 + b1X + b2W + b3Z + b4XW + b5XZ　+ e 　　　　　　　　　　　　　 　　　　　　　;
*    parliamentary is X, formateur is W, seatshare is Z                ;
* formateur_parl is XW, seatshare_parl is XZ, Random Effects                           ; 
********************************************************************** ;

xtset countrycode; 

xtreg portfolioshare parliamentary formateur seatshare 
formateur_parl seatshare_parl, re cluster(countryname);

log close;
exit;
